package com.guigu.buy.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.guigu.buy.dto.Pro_Supplier;
import com.guigu.buy.mapper.SupplierMapper;
import com.guigu.buy.pojo.ProductSupplier;
import com.guigu.buy.mapper.ProductSupplierMapper;
import com.guigu.buy.service.IProductSupplierService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author com.guigu
 * @since 2024-05-15
 */
@Service
public class ProductSupplierServiceImpl extends ServiceImpl<ProductSupplierMapper, ProductSupplier> implements IProductSupplierService {
    @Autowired
    private ProductSupplierMapper productSupplierMapper;
    @Autowired
    private SupplierMapper supplierMapper;
    //查询供应商中间表

    @Override
    public PageInfo<Pro_Supplier> commodity(int uid, int pageNo, int pageSize) {
        int supplierId=supplierMapper.querySupplierId(uid);
        List<Pro_Supplier> list = productSupplierMapper.queyAll(supplierId);
        PageHelper.startPage(pageNo, pageSize);
        PageInfo<Pro_Supplier> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }
}
